package com.zx.crowdfunding.api;

import java.util.List;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.zx.crowdfunding.entity.po.MemberPO;
import com.zx.crowdfunding.entity.vo.AddressVO;
import com.zx.crowdfunding.entity.vo.DetailProjectVO;
import com.zx.crowdfunding.entity.vo.OrderProjectVO;
import com.zx.crowdfunding.entity.vo.OrderVO;
import com.zx.crowdfunding.entity.vo.PortalTypeVO;
import com.zx.crowdfunding.entity.vo.ProjectVO;
import com.zx.crowdfunding.util.ResultEntity;

/**
 * MySQL数据远程服务接口
 * 
 * @author 郑雪
 * @date 2021-12-29
 */
// @FeignClient注解表示当前接口和一个Provider对应，注解中value属性指定要调用的Provider的微服务名称
@FeignClient("crowdfunding-mysql")
public interface MySQLRemoteService {

	/**
	 * 通过登录账号获取会员PO对象的远程接口
	 * @param loginacct 登录账号
	 * @return 携带MemberPO对象的ResultEntity对象
	 */
	@RequestMapping("/get/memberpo/by/login/acct/remote")
	ResultEntity<MemberPO> getMemberPOByLoginAcctRemote(@RequestParam("loginacct") String loginacct);
	
	/**
	 * 添加会员的远程接口
	 * @param memberPO 会员PO对象
	 * @return ResultEntity对象
	 */
	@RequestMapping("/save/member/remote")
	ResultEntity<String> saveMemberRemote(@RequestBody MemberPO memberPO);

	/**
	 * 添加项目的远程接口
	 * @param projectVO 项目VO对象
	 * @param memberId 会员id
	 * @return ResultEntity对象
	 */
	@RequestMapping("/save/project/remote")
	ResultEntity<String> saveProjectVORemote(@RequestBody ProjectVO projectVO, @RequestParam("memberId") Integer memberId);
	
	/**
	 * 获取门户首页项目分类及项目数据的远程接口
	 * @return 携带PortalTypeVO对象集合的ResultEntity对象
	 */
	@RequestMapping("/get/portal/type/project/data/remote")
	ResultEntity<List<PortalTypeVO>> getPortalTypeProjectDataRemote();
	
	/**
	 * 获取项目详情的远程接口
	 * @param projectId 项目id
	 * @return 携带DetailProjectVO对象的ResultEntity对象
	 */
	@RequestMapping("/get/project/detail/remote/{projectId}")
	ResultEntity<DetailProjectVO> getProjectDetailRemote(@PathVariable("projectId") Integer projectId);

	/**
	 * 获取订单项目的远程接口
	 * @param returnId 项目回报id
	 * @return 携带OrderProjectVO对象的ResultEntity对象
	 */
	@RequestMapping("/get/order/project/vo/remote/{returnId}")
	ResultEntity<OrderProjectVO> getOrderProjectVORemote(@PathVariable("returnId") Integer returnId);

	/**
	 * 获取会员收货地址列表的远程接口
	 * @param memberId 会员id
	 * @return 携带AddressVO对象集合的ResultEntity对象
	 */
	@RequestMapping("/get/address/vo/remote/{memberId}")
	ResultEntity<List<AddressVO>> getAddressVORemote(@PathVariable("memberId") Integer memberId);

	/**
	 * 添加会员收货地址的远程接口
	 * @param addressVO 收货地址VO对象
	 * @return ResultEntity对象
	 */
	@RequestMapping("/save/address/vo/remote")
	ResultEntity<String> saveAddressVORemote(@RequestBody AddressVO addressVO);

	/**
	 * 添加订单的远程接口
	 * @param orderVO 订单VO对象
	 * @param memberId 会员id
	 * @return ResultEntity对象
	 */
	@RequestMapping("/save/order/vo/remote")
	ResultEntity<String> saveOrderVORemote(@RequestBody OrderVO orderVO, @RequestParam("memberId") Integer memberId);

	/**
	 * 更新项目进度的远程接口
	 * @param projectId 项目id
	 * @return ResultEntity对象
	 */
	@RequestMapping("/edit/project/progress/remote")
	ResultEntity<String> editProjectProgressRemote(@RequestParam("projectId") Integer projectId);
	
}
